package com.wanban.downloader.db

import com.wanban.downloader.model.M3U8
import com.wanban.downloader.model.Status
import java.io.Serializable


class DownloadEntity(val url: String, val videoName: String, val coverUrl: String? = null): Serializable {
    // 视频id
    var videoId = 0L
    @Status
    // 下载状态
    var state = Status.IDLE
    // 下载的剧集数
    var episode = 0
    // 下载用的线路
    var sourceId = 0
    // 重试次数
    var retryTime = 0
    // 观看时间
    var watchTime = 0L
    // 下载大小
    var contentLength = 0L
    // 当前剧集的名字
    var episodeName: String? = null
    // 文件路径
    var filePath: String? = null
    // 封面路径
    var coverFilePath: String? = null
    // m3u8具体信息
    var m3u8: M3U8? = null
    // header
    var header: HashMap<String, String>? = null

    /**
     * 以下参数不参与数据库存储
     */
    var speed = 0L
    var percent = 0f
    var isSelected = false
    var isUpdateWatchTime = false
    var episodeCount = 0
    var startTaskTime = 0L

    fun getFileName(): String {
        return videoName + "_" + sourceId + "_" + episode
    }
}
